import React from 'react';
import '../../css/subreddit/picker.scss';

export default function Picker(props) {
    const { value, onChange, options } = props;
    return (
        <div className="subreddit-picker">
            <h1>{ value }</h1>
            <select
                onChange={ e => onChange(e.target.value) }
                value={ value }
            >
            {
                options.map(option => (
                    <option value={ option } key={ option }>{ option }</option>
                ))
            }
            </select>
        </div>
    );
};